import Vue from "vue";
import VueResource from "vue-resource";
import {getUser} from "./../util/userUtils"
Vue.use(VueResource);

var apiContext='http://118.89.24.43:8080/yunmusic/';
// var apiContext='/api/yunmusic/';//因为反向代理必须有个标识，为此而配

// 获取歌单
let playlist = This => This.$resource(apiContext + 'top/{playlist}');

// 获取歌单详情
let playlistDetail = This => This.$resource(apiContext + 'playlist/detail')

// 获取歌单评论
let playlistComment = This => This.$resource(apiContext + "comment/playlist")

// 获取歌手的专辑列表
let artistAlbumList = This => This.$resource(apiContext + "artist/album")

// 获取专辑详情
let albumDetail = This => This.$resource(apiContext + "album")

// 获取专辑评论
let albumComment = This => This.$resource(apiContext + "comment/album")

// 歌曲详情
let songDetail = This => This.$resource(apiContext + "song/detail");

let songComment = This => This.$resource(apiContext + "comment/song")

// 登录
let login = This => This.$resource(apiContext + "login")

// 注销
let logout = This => This.$resource(apiContext + "logout")

// 获取用户创建的歌单列表
let userCreatedPlaylists = This => This.$resource(apiContext + "playlist/userCreated")

// 获取用户收藏的歌单列表
let userSubscribePlaylists = This => This.$resource(apiContext + "playlist/userSubscribed")

// 获取用户收藏的歌手列表
// todo

// 获取用户是否收藏歌单
let userIsSubscribePlaylist = This => This.$resource(apiContext + "iscollected/songlist")

// 获取用户详情
let userDetail = This => This.$resource(apiContext + "user/Info")

// 获取歌手详情
let artistDetail = This => This.$resource(apiContext + "artist/detail")

let addSongForPlaylist = This => This.$resource(apiContext + "playlist/add")

// 通过标签ID获取歌单列表
let getPlaylistsByTagId = This => This.$resource(apiContext + "playlistTag/pagination")

let artist = This => This.$resource(apiContext + "/artist")

let getArtistsByTagId = This => This.$resource(apiContext + "artistTag/pagination")

// 得到未读的评论
let notReadComments = This => This.$resource(apiContext + "comment/notRead")

// 得到全文搜索结果
let searchAll = This => This.$resource(apiContext + "comprehensive/search")

let searchSongs = This => This.$resource(apiContext + "song/search")
let searchArtists = This => This.$resource(apiContext + "artist/search")
let searchAlbums = This => This.$resource(apiContext + "album/search")
let searchPlaylists = This => This.$resource(apiContext + "playlist/search")

let album = This => This.$resource(apiContext + "album/all")

export {playlist, playlistDetail, playlistComment, songDetail, login, logout, userCreatedPlaylists, album,
  userDetail, addSongForPlaylist, userSubscribePlaylists, artistDetail, artistAlbumList, albumDetail, albumComment,
  userIsSubscribePlaylist, songComment, getPlaylistsByTagId, artist, getArtistsByTagId, notReadComments,
  searchAll, searchSongs, searchArtists, searchAlbums, searchPlaylists,
  apiContext};
